//
//  CTPopMenuView.h
//  IBDP
//
//  Created by cattsoft on 2017/7/14.
//  Copyright © 2017年 cattsoft. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "CTPopMenuStyle.h"

//屏幕的size，宽，高
#define SCREEN ([[UIScreen mainScreen] bounds].size)
#define CTSCREEN_H SCREEN.height
#define CTSCREEN_W SCREEN.width

typedef void (^action)(NSInteger row);

@class CTPopMenuView;

@protocol CTPopMenuViewDelegate <NSObject>

@optional

- (void)CTPopMenuView:(CTPopMenuView *)menuView didSelectRow:(NSInteger)row;

@end

@interface CTPopMenuView : UIView

@property (nonatomic,strong) CTPopMenuStyle *menuStyle;

/**
 *  popmenu's width,default is 150.
 */
@property (nonatomic,assign) CGFloat menuWidth;

/**
 *  menu cell's height,default is 40.
 */
@property (nonatomic,assign) CGFloat cellHeight;

// menuView's tableView,menu cell's container.
@property (nonatomic,strong) UITableView *tableView;

@property (nonatomic,strong) CAShapeLayer *triangleLayer;

@property (nonatomic,weak) id<CTPopMenuViewDelegate> delegate;

@property (nonatomic,copy) action clickAction;

@property (nonatomic,assign) BOOL dismissed;


- (instancetype)initWithView:(UIView *)view itemWidth:(CGFloat)width itemHeight:(CGFloat)height items:(NSArray *)itemArr style:(CTPopMenuStyle *)menuStyle;

@end
